package com.itheima.boottlias.controller;

import com.itheima.boottlias.domain.vo.Result;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ghy
 * @version 1.0
 * @since 2025-07-10 14:34
 */
@RestController
public class AnnotationController {

    /**
     * RequestParam注解属性如下
     *     value或者name：表示指定请求参数的名称
     *     required() 表示参数是否为必须，默认值true
     *     defaultValue() 如果required属性为false时，可以通过该属性为参数指定默认值
     * @param pageNo
     * @param pageSize
     * @return
     */
    @RequestMapping("/anno/test1")
    public Result testRequestParam(
            @RequestParam(name = "pageNo", required = false, defaultValue = "1") Integer pageNo,
            @RequestParam(name = "pageSize", required = false, defaultValue = "10") Integer pageSize){
        System.out.println("pageNo = " + pageNo);
        System.out.println("pageSize = " + pageSize);
        return Result.success();
    }


}
